﻿using LiveChartsCore;
using LiveChartsCore.Defaults;
using LiveChartsCore.SkiaSharpView;
using System;
using System.Collections.ObjectModel;


namespace DeviceController.Wpf.ViewModels
{
    internal class TargetTemperatureChartViewModel
    {
        public string Title { get; set; }

        private readonly ObservableCollection<ObservablePoint> _values = new();

        public TargetTemperatureChartViewModel()
        {
            Title = "设置温度实时曲线";
            var trend = 1000;
            var r = new Random();
            for (var i = 0; i < 500; i++)
            {
                _values.Add(new ObservablePoint(i, trend += r.Next(-20, 20)));
            }
            Series = new ISeries[]
            {
                new LineSeries<ObservablePoint>
                {
                    Values = _values,
                    GeometryStroke = null,
                    GeometryFill = null,
                    DataPadding = new(0, 1),
                }
            };
            ScrollableAxes = new[] { new Axis() };
            //YAxes = new[] { new Axis() 
            //    //{ MaxLimit = _values.Max(item => item.Y), MinLimit = _values.Min(item => item.Y) }
            //};
        }

        public ISeries[] Series { get; set; }

        public Axis[] ScrollableAxes { get; set; }

        //public Axis[] YAxes { get; set; }
    }
}
